package com.youlu.campus.admin.platform;

import com.youlu.campus.entity.VO.req.PlatformUserComplaintQueryVO;
import com.youlu.campus.service.platform.PlatformUserComplaintService;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * 平台投诉
 */
@RestController
public class PlatformUserComplaintController {
    @Autowired
    private PlatformUserComplaintService platformUserComplaintService;

    @PostMapping("/platform/user-complaint/list")
    public QResult list(@RequestBody @NotNull PlatformUserComplaintQueryVO req) {
        req.setCreateType("visitor");
        return QResult.success(platformUserComplaintService.list(req));
    }

    @GetMapping("/platform/user-complaint/find-one")
    public QResult findOne(@RequestParam("id") String id) {
        return QResult.success(platformUserComplaintService.findOne(id));
    }

    /**
     * 用户投诉统计
     *
     * @param createType
     * @return
     */
    @GetMapping("/platform/user-complaint/statistics")
    public QResult statistics(@RequestParam("createType") String createType) {
        return QResult.success(platformUserComplaintService.statistics(createType));
    }

    @GetMapping("/platform/user-complaint/delete")
    public QResult delete(@RequestParam("id") String id) {
        return QResult.success(platformUserComplaintService.delete(id));
    }
}
